package org.jcc.servlet.encoding.page.writer;

import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.nio.charset.Charset;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/encoding/page/normalwriter/default")
public class EncodingNormalWriterDefault extends HttpServlet {

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String dc = Charset.defaultCharset().toString();
		Writer osw = new OutputStreamWriter(response.getOutputStream());
		String header = "<html><head><meta charset='" + dc + "'></head><body>";
		String footer = "</body></html>";
		osw.write(header + "使用普通字符流，" + dc + footer);
		osw.flush();
	}
	
	private static final long serialVersionUID = 1L;
}
